#include "Timer.h"

CTimer::CTimer(unsigned int aTime) : iWaitTime(-1), iObserver(0)
{
	iTime = aTime;
}

CTimer::~CTimer(void)
{
}

void CTimer::Update(unsigned int aTime)
{
	iTime = aTime;
	if(iObserver && (iWaitTime < aTime))
	{
		iObserver->Finished();
	}
}

void CTimer::Wait(unsigned int aMilliSec, ITimerObserver* aObserver)
{
	iWaitTime = iTime + aMilliSec;
	iObserver = aObserver;
}

void CTimer::RemoveObserver()
{
	iObserver = 0;
}